<?php
$path = __FILE__;
$path = str_replace('administration'. DIRECTORY_SEPARATOR .'Stats'. DIRECTORY_SEPARATOR .'immopie01.php','',$path);
require $path . 'kernel/includes/Artichow-php5/Pie.class.php';  

$data = unserialize($_GET['values']);
if(isset($_GET['legend'])) $legend = unserialize($_GET['legend']);
if(!is_array($data)) exit;

$graph1 = new Graph(400, 300);
$graph1->setBackgroundGradient(
	new LinearGradient(
		new VeryLightGray,
		new White,
		0
	)
);
$graph1->title->set("");
 
$graph1 = new Graph(400, 300);
$plot1 = new Pie(array_values($data));
$plot1->setCenter(0.4, 0.55);
$plot1->setSize(0.6, 0.6 * 4 / 3);
$plot1->label->setCallbackFunction(NULL);

if(isset($legend))
{
    $plot1->setLegend(array_values($legend));
    $plot1->legend->setPosition(1.5);
    $plot1->legend->setBackgroundColor(new VeryLightGray(30));
}

$graph1->add($plot1);
$graph1->draw();
?>